import {createRouter ,  createWebHistory } from 'vue-router'
const routers = createRouter({
    // history:  createWebHashHistory(),
    history:  createWebHistory(),
    // base:'/mynewsweb',process.env.BASE_URL  createMemoryHistory  "/pord-api"
    routes:[
        // {
        //     path: "/",
        //     name: "index",
        //     meta:{
        //         title: '首页',
        //         parentPath: '/'
        //     },
        //     component:() => import("@/views/index.vue"),
        //     // children: [
        //     // ]
        // },
        {
            path: "/",
            name: "index",
            meta:{
                title: '首页',
                parentPath: '/'
            },
            redirect: "/local",
            component:() => import("@/views/index.vue"),
            children:[
                {
                    path: "local",
                    name: "localForum",
                    meta:{
                        title: '本地校园论坛',
                        parentPath: '/local'
                    },
                    component:() => import("@/views/schoolForum/localForumPage.vue"),
                },
                {
                    path: "all",
                    name: "allForum",
                    meta:{
                        title: '全国校园论坛',
                        parentPath: '/all'
                    },
                    component:() => import("@/views/schoolForum/ForumPage.vue"),
                },
            ]
        },
        {
            path: "/post/:postId",
            name: "postDetail",
            meta:{
                title: '贴子详情',
                parentPath: '/post/:postId'
            },
            component:() => import("@/views/schoolForum/PostDetail.vue")
            // component:() => import("@/views/test/ForumReview.vue")
        },
        {
            path: "/person",
            name: "person",
            meta:{
                title: '个人主页',
                parentPath: '/person'
            },
            component:() => import("@/views/person/Person.vue")
            // component:() => import("@/views/test/ForumReview.vue")
        },
        // {
        //     path: "/post/:postId",
        //     name: "postDetail",
        //     component:() => import("@/views/schoolForum/PostDetail.vue")
        // },
        {
            path: "/login",
            name: "login",
            meta:{
                title: '登录页',
                parentPath: '/login'
            },
            component:() => import("@/views/login.vue")
        },
        {
            path: "/updatePassword",
            name: "updatePassword",
            meta:{
                title: '忘记密码',
                parentPath: '/updatePassword'
            },
            component:() => import("@/views/updatePassword.vue")
        },
        {
            path: "/register",
            name: "register",
            meta:{
                title: '注册页',
                parentPath: '/register'
            },
            component:() => import("@/views/register.vue")
        },
        // {forum-qian
        //     path: "/channel/:id",
        //     name: "ChannelNews",
        //     component:() => import("@/views/ChannelNews.vue")
        // },
        {
            path: "/:catchAll(.*)",
            name: "404",
            meta:{
                title: '404',
                parentPath: '/404'
            },
            component:() => import("@/views/error/404")
        },
        {
            path: '/401',
            meta:{
                title: '401',
                parentPath: '/401'
            },
            component: () => import('@/views/error/401'),
            // hidden: true
        },
        {
            path: '/404',
            meta:{
                title: '404',
                parentPath: '/404'
            },
            component: () => import('@/views/error/404'),
            // hidden: true
        },
    ]
})

export default routers